Debian 8 Jessie
Sponsored Link

Configure NFS Client
2015/05/05
 
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [    NFS Server    ] |10.0.0.30 | 10.0.0.31| [    NFS Client    ] |
|     dlp.srv.world    +----------+----------+   client.srv.world   |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Configure NFS Client.
root@client:~#
aptitude -y install nfs-client
root@client:~#
vi /etc/idmapd.conf
# line 6: uncomment and change to your domain name

Domain =
srv.world
root@client:~#
mount -t nfs dlp.srv.world:/home /home

root@client:~#
df -hT

Filesystem             Type      Size  Used Avail Use% Mounted on
/dev/dm-0              ext4      142G  1.3G  133G   1% /
udev                   devtmpfs   10M     0   10M   0% /dev
tmpfs                  tmpfs     1.6G  8.6M  1.6G   1% /run
tmpfs                  tmpfs     4.0G     0  4.0G   0% /dev/shm
tmpfs                  tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs                  tmpfs     4.0G     0  4.0G   0% /sys/fs/cgroup
/dev/sda1              ext2      236M   33M  191M  15% /boot
dlp.srv.world:/home nfs4      142G  1.3G  133G   1% /home
# /home from NFS server is mounted
[2] Configure NFS mounting on fstab to mount it when the system boot.
root@client:~#
vi /etc/fstab
# add like follows

dlp.srv.world:/home   /home  nfs     defaults        0       0
[3] Configure auto-mounting.
For example, set NFS directory on /mntdir.
root@client:~#
aptitude -y install autofs
root@client:~#
vi /etc/auto.master
# add follows to the end

/-    /etc/auto.mount

root@client:~#
vi /etc/auto.mount
# create new : [mount point] [option] [location]

/mntdir -fstype=nfs,rw  dlp.srv.world:/home

root@client:~#
mkdir /mntdir

root@client:~#
systemctl restart autofs

# move to the mount point to make sure it normally mounted

root@client:~#
cd /mntdir

root@client:/mntdir#
total 8
drwxr-xr-x 2 debian debian 4096 May  1 22:55 debian
drwxr-xr-x 2 jessie jessie 4096 May  1 22:59 jessie

root@client:/mntdir#
cat /proc/mounts | grep mntdir

/etc/auto.mount /mntdir autofs rw,relatime,fd=6,pgrp=1774,timeout=300,minproto=5,maxproto=5,direct 0 0
dlp.srv.world:/home /mntdir nfs4 rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,
port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.214,local_lock=none,addr=10.0.0.30 0 0
 
Tweet